package com.kehutong.charge.vo;

import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;

public class ChargeBillItemsOrganizeTreeVO implements Serializable {

    private static final long serialVersionUID = 1879383975090892461L;

    private String id;
    private String pid;
    private String name;
    private List<ChargeBillItemsOrganizeTreeVO> childList;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public List<ChargeBillItemsOrganizeTreeVO> getChildList() {
        if (Objects.isNull(childList)) {
            return Collections.emptyList();
        }

        return childList;
    }

    public void setChildList(List<ChargeBillItemsOrganizeTreeVO> childList) {
        this.childList = childList;
    }

    public void addChild(ChargeBillItemsOrganizeTreeVO child) {
        if (Objects.isNull(childList)) {
            childList = new LinkedList<>();
        }

        childList.add(child);
    }
}
